Passed
Branch master (27f176)
by refat
18:17
created

gitty.js ➔ cbpush   A

Complexity

Conditions 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
const { exec } = require('child_process');
2
3
const args = process.argv;
4
process.argv.splice(0, 2);
5
const str = args.join(' ');
6
7
function cbpush(err) {
8
  if (err) {
9
    console.log(err);
1 ignored issue
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
10
    return;
11
  }
12
  console.log('done');
13
}
14
15
function cbcommit(err) {
16
  if (err) {
17
    console.log(err);
1 ignored issue
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
18
    return;
19
  }
20
  exec('git push', cbpush);
21
}
22
23
function cbadd(err) {
24
  if (err) {
25
    console.log(err);
1 ignored issue
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
26
    return;
27
  }
28
  exec(`git commit -m "${str}"`, cbcommit);
29
}
30
31
exec('git add .', cbadd);
32